﻿using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using ZeroAdmin.Application;

namespace ZeroAdmin.Web.Core;

/// <summary>
/// 系统操作
/// </summary>
/// <param name="service"></param>
[ApiDescriptionSettings("SystemOperate", Name = "SysOperate", Order = 1, Tag = "系统操作")]
[AllowAnonymous]
public class SysOperateController(ISysOperateService service) : IDynamicApiController
{
    private readonly ISysOperateService _service = service;

    /// <summary>
    /// 数据库操作：批量建表
    /// 执行效果：将数据库的表结构更新，表结构与代码一致。
    /// </summary>
    public void CreateTable()
    {
        _service.CreateTable();
    }

    /// <summary>
    /// 数据库操作：建立基础数据
    /// 执行要求：确保第一次建立基础数据
    /// </summary>
    /// <returns></returns>
    public async Task CreateBasicData()
    {
        await _service.CreateBasicData();
    }
}
